package org.moonshot.chatty.lex;

public class ChattyLexeme
{
    public final LexemeType type;
    public final String text;
    public final int start;
    public final int end;
    
    protected ChattyLexeme(int aStart, int aEnd, LexemeType aType)
    {
        start = aStart;
        end = aEnd;
        type = aType;
        text = null;
    }
    
    protected ChattyLexeme(int aStart, int aEnd, LexemeType aType, String aText)
    {
        start = aStart;
        end = aEnd;
        type = aType;
        text = aText;
    }
    
    public String toString ()
    {
        return type.name () + (text==null ? "" : "("+text+")");
    }
}
